from PIL import Image
import wordcloud
import numpy as np
import imageio

f = open('1.txt', 'r', encoding="utf-8")
name = f.read()
f.close()
print(name)



win = 'SimHei.ttf'

image = imageio.imread("123.jpg")


ciyun = wordcloud.WordCloud(
    width=2000,
    height=1300,
    font_path='SimHei.ttf',  # 字号
    repeat=True,
    max_words = 1000,
    colormap='rainbow',
    background_color="black")  # 背景色



ciyun.generate(name)
ciyun.to_file('词云.png')

p = Image.open('词云.png')
p.show()